unit Ue_def;

interface

uses GetConf,controls,graphics,classes;

var
 conf:Tunitcfg;

Procedure LoadUnitsIcon(ul,il1:TimageList);

implementation

Procedure LoadUnitsIcon;
var
 x1,x2,y1,y2,i,j:integer;
 b1:Tbitmap;
 bm:Tbitmap;
begin
  bm:=Tbitmap.create;
  bm.loadfromfile('units.bmp');
  ul.createsize(29,29);
  b1:=Tbitmap.create;
  b1.width:=30;
  b1.height:=30;
  for j:=1 to 3 do for i:=1 to 10 do begin
   x1:=30*(i-1)+5;y1:=30*(j-1)+5;
   if i>1 then x1:=x1+5*(i-1);
   if j>1 then y1:=y1+5*(j-1);
   x2:=x1+29;y2:=y1+29;
   b1.Canvas.CopyRect(rect(0,0,29,29),bm.canvas,rect(x1,y1,x2,y2));
   ul.addmasked(b1,clWhite);
  end;
  bm.free;
  b1.free;

  bm:=Tbitmap.create;
  bm.loadfromfile('terrain.bmp');
  il1.createsize(29,29);
  b1:=Tbitmap.create;
  b1.width:=30;
  b1.height:=30;
  for j:=1 to 9 do for i:=1 to 20 do begin
   x1:=29*(i-1)+6;y1:=29*(j-1)+6;
   if i>1 then x1:=x1+6*(i-1);
   if j>1 then y1:=y1+6*(j-1);
   x2:=x1+29;y2:=y1+29;
   b1.Canvas.CopyRect(rect(0,0,30,30),bm.canvas,rect(x1,y1,x2,y2));
   if il1.count=110 then il1.addmasked(b1,clwhite) else il1.add(b1,nil);
  end;
  bm.free;
  b1.free;

end;

end.
